package com.cashmama.market.api.infras.enums.order;

import com.google.common.collect.Lists;

import java.util.List;

public enum BorrowStatusEnum {

    AWAIT_BORROW(0, "Waiting for loan", "Completed", Lists.newArrayList(99)), //等待借款
    PENDING(1, "Under review", "Reviewing", Lists.newArrayList(0,1,2)),//审核中
    PENDING_FAILD(2, "Transfer Failed", "Transfer Failed", Lists.newArrayList(4)),//放款失败
    REPAY(3, "Waiting for Repay", "Waiting for Repay", Lists.newArrayList(5)), // 待还款
    REFUSE(4, "Reject", "Refused", Lists.newArrayList(10)),  // 拒绝
    HIGH_MARK(5, "Waiting for High mark", "HighMark", Lists.newArrayList(-1)),
    OVER_DUE(6, "Overdue", "Overdue", Lists.newArrayList(6)),
    RE_EDIT(7, "Re-edit", "ReEdit", Lists.newArrayList(-2)),
    VERIFY(8, "Verify", "VERIFY", Lists.newArrayList(-3)), // 信息修改
    PENDING_WITHDRAWAL(11, "Waiting for withdrawal", "Withdraw Now", Lists.newArrayList(11)),//待提现
    TRANSFERRING(10, "Transferring", "Transferring", Lists.newArrayList(3)),//打款中
    COMPLETED(12, "Completed", "Completed", Lists.newArrayList(7,8,9)),//已完成（订单列表）
    ;

    private Integer code;
    private String desc;
    private String title;
    private List<Integer> bizCode;

    BorrowStatusEnum(Integer code, String desc, String title, List<Integer> bizCode) {
        this.code = code;
        this.desc = desc;
        this.title = title;
        this.bizCode = bizCode;
    }

    BorrowStatusEnum(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    BorrowStatusEnum(Integer code, String desc, String title) {
        this.code = code;
        this.desc = desc;
        this.title = title;
    }

    public List<Integer> getBizCode() {
        return bizCode;
    }

    public BorrowStatusEnum setBizCode(List<Integer> bizCode) {
        this.bizCode = bizCode;
        return this;
    }

    public String getTitle() {
        return title;
    }

    public BorrowStatusEnum setTitle(String title) {
        this.title = title;
        return this;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    public static BorrowStatusEnum getByCode(Integer code){
        for(BorrowStatusEnum statusEnum : BorrowStatusEnum.values()){
            if(statusEnum.getBizCode().contains(code)){
                return statusEnum;
            }
        }
        return null;
    }
}
